package io.shuttle.mbe.api

import io.shuttle.mbe.api.types.StringOrNumber

interface HarFormat {
    /**
     * HTTP Archive 1.2
     *
     * http://www.softwareishard.com/blog/har-12-spec
     */
    data class Har(
        /** This object represents the root of exported data. */
        var log: Log
    )

    /**
     * This object (`log`) represents the root of exported data.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#log
     */
    data class Log(
        /**
         * Version number of the format.
         *
         * _If empty, string "1.1" is assumed by default._
         */
        var version: String,
        /** Name and version info of the log creator application. */
        var creator: Creator,
        /** Name and version info of used browser. */
        var browser: Browser?,
        /**
         * List of all exported (tracked) pages.
         *
         * _Leave out this field if the application
         * does not support grouping by pages._
         *
         * There is one `<page>` object for every exported web page and one
         * `<entry>` object for every HTTP request.
         * In case when an HTTP trace tool isn't able to group requests by a page,
         * the `<pages>` object is empty and individual requests doesn't have a
         * parent page.
         */
        var pages: List<Page>?,
        /** List of all exported (tracked) requests. */
        var entries: List<Entry>?,
        /** A comment provided by the user or the application. */
        var comment: String?,
    )

    /**
     * Infos about application/browser used to export the log.
     *
     * `Creator` and `Browser` objects share the same structure.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#creator
     */
    data class Creator(
        /** Name of the application/browser used to export the log. */
        var name: String,
        /** Version of the application/browser used to export the log. */
        var version: String,
        /** A comment provided by the user or the application. */
        var comment: String?,
    )

    /**
     * Infos about application/browser used to export the log.
     *
     * `Browser` and `Creator` objects share the same structure.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#browser
     */
    data class Browser(
        /** Name of the application/browser used to export the log. */
        var name: String,

        /** Version of the application/browser used to export the log. */
        var version: String,

        /** A comment provided by the user or the application. */
        var comment: String?,
    )

    /**
     * This object represents list of exported pages.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#pages
     */
    data class Page(
        /**
         * Date and time stamp for the beginning of the page load
         *
         * (ISO 8601 - `YYYY-MM-DDThh:mm:ss.sTZD`,
         * e.g. `2009-07-24T19:20:30.45+01:00`).
         */
        var startedDateTime: String,
        /**
         * Unique identifier of a page within the `<log>` (HAR doc).
         * Entries use it to refer the parent page.
         */
        var id: String,
        /** Page title. */
        var title: String,
        /** Detailed timing info about page load */
        var pageTimings: PageTiming,
        /**  A comment provided by the user or the application */
        var comment: String?,
        /** _non-standard_  */
        /** _non-standard_  */
        var _adult_site: Number?,
        /** _non-standard_  */
        var _aft: Number,
        /** _non-standard_  */
        var _base_page_cdn: String?,
        /** _non-standard_  */
        var _base_page_redirects: Number?,
        /** _non-standard_  */
        var _base_page_ttfb: Number?,
        /** _non-standard_  */
        var _browser_main_memory_kb: Number?,
        /** _non-standard_  */
        var _browser_name: String?,
        /** _non-standard_  */
        var _browser_other_private_memory_kb: Number?,
        /** _non-standard_  */
        var _browser_process_count: Number?,
        /** _non-standard_  */
        var _browser_version: String?,
        /** _non-standard_  */
        var _browser_working_set_kb: Number?,
        /** _non-standard_  */
        var _bytesIn: Number?,
        /** _non-standard_  */
        var _bytesInDoc: Number?,
        /** _non-standard_  */
        var _bytesOut: Number?,
        /** _non-standard_  */
        var _bytesOutDoc: Number?,
        /** _non-standard_  */
        var _cached: Number?,
        /** _non-standard_  */
        var _certificate_bytes: Number?,
        /** _non-standard_  */
        var _connections: Number?,
        /** _non-standard_  */
        var _date: Number?,
        /** _non-standard_  */
        var _docCPUms: Number?,
        /** _non-standard_  */
        var _docCPUpct: Number?,
        /** _non-standard_  */
        var _docTime: Number?,
        /** _non-standard_  */
        var _domContentLoadedEventEnd: Number?,
        /** _non-standard_  */
        var _domContentLoadedEventStart: Number?,
        /** _non-standard_  */
        var _domElements: Number?,
        /** _non-standard_  */
        var _domInteractive: Number?,
        /** _non-standard_  */
        var _domLoading: Number?,
        /** _non-standard_  */
        var _domTime: Number?,
        /** _non-standard_  */
        var _effectiveBps: Number?,
        /** _non-standard_  */
        var _effectiveBpsDoc: Number?,
        /** _non-standard_  */
        var _eventName: String?,
        /** _non-standard_  */
        var _firstPaint: Number?,
        /** _non-standard_  */
        var _fixed_viewport: Number?,
        /** _non-standard_  */
        var _fullyLoaded: Number?,
        /** _non-standard_  */
        var _fullyLoadedCPUms: Number?,
        /** _non-standard_  */
        var _fullyLoadedCPUpct: Number?,
        /** _non-standard_  */
        var _gzip_savings: Number?,
        /** _non-standard_  */
        var _gzip_total: Number?,
        /** _non-standard_  */
        var _image_savings: Number?,
        /** _non-standard_  */
        var _image_total: Number?,
        /** _non-standard_  */
        var _isResponsive: Number?,
        /** _non-standard_  */
        var _lastVisualChange: Number?,
        /** _non-standard_  */
        var _loadEventEnd: Number?,
        /** _non-standard_  */
        var _loadEventStart: Number?,
        /** _non-standard_  */
        var _loadTime: Number?,
        /** _non-standard_  */
        var _minify_savings: Number?,
        /** _non-standard_  */
        var _minify_total: Number?,
        /** _non-standard_  */
        var _optimization_checked: Number?,
        /** _non-standard_  */
        var _pageSpeedVersion: String?,
        /** _non-standard_  */
        var _render: Number?,
        /** _non-standard_  */
        var _requests: Number?,
        /** _non-standard_  */
        var _requestsDoc: Number?,
        /** _non-standard_  */
        var _requestsFull: Number?,
        /** _non-standard_  */
        var _responses_200: Number?,
        /** _non-standard_  */
        var _responses_404: Number?,
        /** _non-standard_  */
        var _responses_other: Number?,
        /** _non-standard_  */
        var _result: Number?,
        /** _non-standard_  */
        var _run: Number?,
        /** _non-standard_  */
        var _score_cache: Number?,
        /** _non-standard_  */
        var _score_cdn: Number?,
        /** _non-standard_  */
        var _score_combine: Number?,
        /** _non-standard_  */
        var _score_compress: Number?,
        /** _non-standard_  */
        var _score_cookies: Number?,
        /** _non-standard_  */
        var _score_etags: Number?,
        /** _non-standard_  */
        var _score_gzip: Number?,
        /** _non-standard_  */
        var `_score_keep-alive`: Number?,
        /** _non-standard_  */
        var _score_minify: Number?,
        /** _non-standard_  */
        var _score_progressive_jpeg: Number?,
        /** _non-standard_  */
        var _server_count: Number?,
        /** _non-standard_  */
        var _server_rtt: Number?,
        /** _non-standard_  */
        var _SpeedIndex: Number?,
        /** _non-standard_  */
        var _step: Number?,
        /** _non-standard_  */
        var _title: String?,
        /** _non-standard_  */
        var _titleTime: Number?,
        /** _non-standard_  */
        var _TTFB: Number,
        /** _non-standard_  */
        var _URL: String,
        /** _non-standard_  */
        var _visualComplete: Number?,
        /**
         * _non-standard_
         *
         * See "Custom Fields" under http://www.softwareishard.com/blog/har-12-spec
         */
        var customFiled: Map<String, Any>? = null
    )

    /**
     * This object describes timings for various events (states) fired during the
     * page load.
     *
     * All times are specified in milliseconds.
     *
     * If a time info is not available appropriate field is set to `-1`.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#pageTimings
     */
    data class PageTiming(
        /**
         * Content of the page loaded. Number of milliseconds since page load
         * started (`page.startedDateTime`).
         *
         * Use `-1` if the timing does not apply to the current request.
         */
        var onContentLoad: Number?,
        /**
         * Page is loaded (`onLoad` event fired). Number of milliseconds since
         * page load started (`page.startedDateTime`).
         *
         * Use `-1` if the timing does not apply to the current request.
         */
        var onLoad: Number?,
        /** A comment provided by the user or the application */
        var comment: String?,
        var _startRender: Number?,
    )

    /**
     * _non-standard_
     *
     * Data for Chunk as provided by e.g. WebPageTest
     */
    data class Chunk(
        var bytes: Number,
        var ts: Number,
    )

    /**
     * _non-standard_
     *
     * This object describes the initiator of a request (the location of the
     * code that issued the request) and is used to populate the Entry's
     * non-standard `_initiator` field.
     */
    data class Initiator(
        /**
         * presumably equivalent to _initiator_type
         *
         * values "parser" and "other" have been observed in Chrome's HARs
         */
        var type: String,
        /**
         * The URL of the code file in which the code that issued the
         * request represented by the Entry (this object's parent) resides.
         * This would otherwise be the string in the Entry's `_initiator` field.
         */
        var url: String?,
        /**
         * The line number of the code that issued the request represented
         * by the Entry to which this Initiator object has been attached.
         */
        var lineNumber: Number?,
        /**
         * The column number of the code that issued the request.
         */
        var column: Number?,
        /**
         * The detail information that would be in `_initiator_detail`.
         */
        var detail: String?,
    )

    /**
     * This object represents an array with all exported HTTP requests. Sorting
     * entries by `startedDateTime` (starting from the oldest) is preferred way how
     * to export data since it can make importing faster.
     * However the reader application should always make sure the array is sorted
     * (if required for the import).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#entries
     */
    data class Entry(
        /**
         * Reference to the parent page. Leave out this field if the application
         * does not support grouping by pages.
         */
        var pageref: String?,
        /**
         * Date and time stamp of the request start
         *
         * (ISO 8601 - `YYYY-MM-DDThh:mm:ss.sTZD`).
         */
        var startedDateTime: String,
        /**
         * Total elapsed time of the request in milliseconds.
         *
         * This is the sum of all timings available in the timings object
         * (i.e. not including `-1` values).
         */
        var time: Number,
        /** Detailed info about the request. */
        var request: Request,
        /** Detailed info about the response. */
        var response: Response,
        /** Info about cache usage. */
        var cache: Cache,
        /** Detailed timing info about request/response round trip. */
        var timings: Timings,
        /**
         * IP address of the server that was connected
         * (result of DNS resolution).
         */
        var serverIPAddress: String?,
        /**
         * Unique ID of the parent TCP/IP connection, can be the client or server
         * port number.
         *
         * Note that a port number doesn't have to be unique identifier
         * in cases where the port is shared for more connections.
         *
         * If the port isn't available for the application, any other unique
         * connection ID can be used instead (e.g. connection index). Leave out
         * this field if the application doesn't support this info.
         */
        var connection: String?,
        /**  A comment provided by the user or the application */
        var comment: String?,
        /** _non-standard_  */
        var _all_end: StringOrNumber?,
        /** _non-standard_  */
        var _all_ms: StringOrNumber?,
        /** _non-standard_  */
        var _all_start: StringOrNumber?,
        /** _non-standard_  */
        var _bytesIn: StringOrNumber?,
        /** _non-standard_  */
        var _bytesOut: StringOrNumber?,
        /** _non-standard_  */
        var _cacheControl: String?,
        /** _non-standard_  */
        var _cache_time: StringOrNumber?,
        /** _non-standard_  */
        var _cdn_provider: String?,
        /** _non-standard_  */
        var _certificate_bytes: StringOrNumber?,
        /** _non-standard_  */
        var _chunks: List<Chunk>?,
        /** _non-standard_  */
        var _client_port: StringOrNumber?,
        /** _non-standard_  */
        var _connect_end: StringOrNumber?,
        /** _non-standard_  */
        var _connect_ms: StringOrNumber?,
        /** _non-standard_  */
        var _connect_start: StringOrNumber?,
        /** _non-standard_  */
        var _contentEncoding: String?,
        /** _non-standard_  */
        var _contentType: String?,
        /** _non-standard_  */
        var _dns_end: StringOrNumber?,
        /** _non-standard_  */
        var _dns_ms: StringOrNumber?,
        /** _non-standard_  */
        var _dns_start: StringOrNumber?,
        /** _non-standard_  */
        var _download_end: StringOrNumber?,
        /** _non-standard_  */
        var _download_ms: StringOrNumber?,
        /** _non-standard_  */
        var _download_start: StringOrNumber?,
        /** _non-standard_  */
        var _expires: String?,
        /** _non-standard_  */
        var _fromCache: FromCache?,
        /** _non-standard_  */
        var _full_url: String?,
        /** _non-standard_  */
        var _gzip_save: StringOrNumber?,
        /** _non-standard_  */
        var _gzip_total: StringOrNumber?,
        /** _non-standard_  */
        var _host: String?,
        /** _non-standard_  */
        var _http2_stream_dependency: StringOrNumber?,
        /** _non-standard_  */
        var _http2_stream_exclusive: StringOrNumber?,
        /** _non-standard_  */
        var _http2_stream_id: StringOrNumber?,
        /** _non-standard_  */
        var _http2_stream_weight: StringOrNumber?,
        /** _non-standard_  */
        var _image_save: StringOrNumber?,
        /** _non-standard_  */
        var _image_total: StringOrNumber?,
        /** _non-standard_  */
        var _index: Number?,
        /** _non-standard_  */
        var _initiator: InitiatorString?,
        /** _non-standard_  */
        var _initiator_column: Number?,
        /** _non-standard_  */
        var _initiator_detail: String?,
        /** _non-standard_  */
        var _initiator_function: String?,
        /** _non-standard_  */
        var _initiator_line: Number?,
        /** _non-standard_  */
        var _initiator_type: String?,
        /** _non-standard_  */
        var _ip_addr: String?,
        /** _non-standard_  */
        var _is_secure: StringOrNumber?,
        /** _non-standard_  */
        var _jpeg_scan_count: StringOrNumber?,
        /** _non-standard_  */
        var _load_end: StringOrNumber?,
        /** _non-standard_  */
        var _load_ms: StringOrNumber?,
        /** _non-standard_  */
        var _load_start: StringOrNumber?,
        /** _non-standard_  */
        var _method: String?,
        /** _non-standard_  */
        var _minify_save: StringOrNumber?,
        /** _non-standard_  */
        var _minify_total: StringOrNumber?,
        /** _non-standard_  */
        var _number: Number?,
        /** _non-standard_  */
        var _objectSize: StringOrNumber?,
        /** _non-standard_  */
        var _objectSizeUncompressed: StringOrNumber?,
        /** _non-standard_  */
        var _priority: String?,
        /** _non-standard_  */
        var _protocol: StringOrNumber?,
        /** _non-standard_  */
        var _request_id: StringOrNumber?,
        /** _non-standard_  */
        var _resourceType: ResourceType?,
        /** _non-standard_  */
        var _responseCode: StringOrNumber?,
        /** _non-standard_  */
        var _score_cache: StringOrNumber?,
        /** _non-standard_  */
        var _score_cdn: StringOrNumber?,
        /** _non-standard_  */
        var _score_combine: StringOrNumber?,
        /** _non-standard_  */
        var _score_compress: StringOrNumber?,
        /** _non-standard_  */
        var _score_cookies: StringOrNumber?,
        /** _non-standard_  */
        var _score_etags: StringOrNumber?,
        /** _non-standard_  */
        var _score_gzip: StringOrNumber?,
        /** _non-standard_  */
        var _score_keep_alive: StringOrNumber?,
        /** _non-standard_  */
        var _score_minify: StringOrNumber?,
        /** _non-standard_  */
        var _score_progressive_jpeg: Number?,
        /** _non-standard_  */
        var _server_count: StringOrNumber?,
        /** _non-standard_  */
        var _server_rtt: StringOrNumber?,
        /** _non-standard_  */
        var _socket: StringOrNumber?,
        /** _non-standard_  */
        var _ssl_end: StringOrNumber?,
        /** _non-standard_  */
        var _ssl_ms: StringOrNumber?,
        /** _non-standard_  */
        var _ssl_start: StringOrNumber?,
        /** _non-standard_  */
        var _ttfb_end: StringOrNumber?,
        /** _non-standard_  */
        var _ttfb_ms: StringOrNumber?,
        /** _non-standard_  */
        var _ttfb_start: StringOrNumber?,
        /** _non-standard_  */
        var _type: StringOrNumber?,
        /** _non-standard_  */
        var _url: String?,
        /** _non-standard_  */
        var _was_pushed: StringOrNumber?,
        /** _non-standard_  */
        var _initialPriority: String?,
        /** _non-standard_  */
        var _renderBlocking: String?,
        /** _non-standard_  */
        var _isLCP: Boolean?,
        /** _non-standard_  */
        var _webSocketMessages: List<WebSocketMessage>?,
        /**
         * _non-standard_
         *
         * See "Custom Fields" under http://www.softwareishard.com/blog/har-12-spec
         */
        var customFiled: Map<String, Any>? = null
    )

    data class WebSocketMessage(
        var type: WebSocketType,
        var timeout: Number,
        var opcode: Number,
        var data: String
    )

    enum class WebSocketType {
        send,
        receive
    }

    sealed class InitiatorString {
        data class Initiator1(var value: Initiator) : InitiatorString()
        data class Str(var value: String) : InitiatorString()
    }

    enum class FromCache {
        memory,
        disk
    }

    enum class ResourceType {
        document,
        stylesheet,
        image,
        media,
        font,
        script,
        texttrack,
        xhr,
        fetch,
        prefetch,
        eventsource,
        websocket,
        webtransport,
        wasm,
        manifest,
        `signed-exchange`,
        ping,
        cspViolationReport,
        other,
        preflight,
        smScript,
        smStylesheet,
        webbundle
    }

    /**
     * This object contains detailed info about performed request.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#request
     */
    data class Request(
        /** Request method (`GET`, `POST`, ...). */
        var method: String,
        /** Absolute URL of the request (fragments are not included). */
        var url: String,
        /** Request HTTP Version. */
        var httpVersion: String,
        /** List of cookie objects. */
        var cookies: List<Cookie>,
        /** List of header objects. */
        var headers: List<Header>,
        /** List of query parameter objects. */
        var queryString: List<QueryString>,
        /** Posted data info. */
        var postData: PostData?,
        /**
         * Total number of bytes from the start of the HTTP request message until
         * (and including) the double CRLF before the body.
         *
         * Set to `-1` if the info is not available.
         */
        var headersSize: Number,
        /**
         * Size of the request body (POST data payload) in bytes.
         *
         * Set to `-1` if the info is not available.
         */
        var bodySize: Number,
        /**  A comment provided by the user or the application */
        var comment: String?
    )

    /**
     * This object contains detailed info about the response.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#response
     */
    data class Response(
        /** Response status. */
        var status: Number,
        /** Response status description. */
        var statusText: String,
        /** Response HTTP Version. */
        var httpVersion: String,
        /** List of cookie objects. */
        var cookies: List<Cookie>,
        /** List of header objects. */
        var headers: List<Header>,
        /** Details about the response body. */
        var content: Content,
        /** Redirection target URL from the Location response header. */
        var redirectURL: String,
        /**
         * Total number of bytes from the start of the HTTP response message until
         * (and including) the double CRLF before the body.
         *
         * Set to `-1` if the info is not available.
         *
         * _The size of received response-headers is computed only from headers
         * that are really received from the server. Additional headers appended by
         * the browser are not included in this number, but they appear in the list
         * of header objects._
         */
        var headersSize: Number,
        /**
         * Size of the received response body in bytes.
         *
         * - Set to zero in case of responses coming from the cache (`304`).
         * - Set to `-1` if the info is not available.
         */
        var bodySize: Number,
        /**  A comment provided by the user or the application */
        var comment: String?,
        /** _non-standard_  */
        var _transferSize: Number?,
    )

    /**
     * This object contains list of all cookies (used in `request` and `response`
     * objects).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#cookies
     */
    data class Cookie(
        /** The name of the cookie. */
        var name: String,
        /** The cookie value. */
        var value: String,
        /** The path pertaining to the cookie. */
        var path: String?,
        /** The host of the cookie. */
        var domain: String?,
        /**
         * Cookie expiration time.
         * (ISO 8601 - `YYYY-MM-DDThh:mm:ss.sTZD`,
         * e.g. `2009-07-24T19:20:30.123+02:00`).
         */
        var expires: String?,
        /** Set to true if the cookie is HTTP only, false otherwise. */
        var httpOnly: Boolean?,
        /** True if the cookie was transmitted over ssl, false otherwise. */
        var secure: Boolean?,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * This object represents a headers (used in `request` and `response` objects).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#headers
     */
    data class Header(
        var name: String,
        var value: String,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * This object represents a parameter & value parsed from a query string,
     * if any (embedded in `request` object).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#queryString
     */
    data class QueryString(
        var name: String,
        var value: String,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )
    /**
     * This object describes posted data, if any (embedded in `request` object).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#postData
     */
//typealias PostData = PostDataCommon & (PostDataParams or PostDataText)

    /**
     * The common properties of PostData
     */
    data

    class PostDataCommon(
        /** Mime type of posted data. */
        var mimeType: String,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * Post data with `params` specified.
     */
    data class PostDataParams(
        /**
         * List of posted parameters (in case of URL encoded parameters).
         */
        var params: List<Param>,

        /**
         * _`params` and `text` fields are mutually exclusive._
         */
        var text: Void
    )

    /**
     * Post data with `text` specified.
     */
    data class PostDataText(
        /**
         * Plain text posted data
         */
        var text: String,

        /**
         * _`params` and `text` fields are mutually exclusive._
         */
        var params: Void
    )

    /**
     * List of posted parameters, if any (embedded in `postData` object).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#params
     */
    data class Param(
        /** name of a posted parameter. */
        var name: String,
        /** value of a posted parameter or content of a posted file */
        var value: String?,
        /** name of a posted file. */
        var fileName: String?,
        /** content type of a posted file. */
        var contentType: String?,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * This object describes details about response content
     * (embedded in `response` object).
     *
     * http://www.softwareishard.com/blog/har-12-spec/#content
     */
    data class Content(
        /**
         * Length of the returned content in bytes.
         *
         * Should be equal to `response.bodySize` if there is no compression and
         * bigger when the content has been compressed.
         */
        var size: Number,
        /**
         * Number of bytes saved. Leave out this field if the information is not
         * available.
         */
        var compression: Number?,
        /**
         * MIME type of the response text (value of the Content-Type response
         * header).
         *
         * The charset attribute of the MIME type is included (if available).
         */
        var mimeType: String,
        /**
         * Response body sent from the server or loaded from the browser cache.
         *
         * This field is populated with textual content only.
         *
         * The text field is either HTTP decoded text or a encoded (e.g. `base64`)
         * representation of the response body.
         *
         * Leave out this field if the information is not available.
         */
        var text: String?,
        /**
         * Encoding used for response text field e.g `base64`.
         *
         * Leave out this field if the text field is HTTP decoded
         * (decompressed & unchunked), than trans-coded from its original character
         * set into UTF-8.
         */
        var encoding: String?,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * This objects contains info about a request coming from browser cache.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#cache
     */
    data class Cache(
        /**
         * State of a cache entry before the request.
         *
         * Leave out this field if the information is not available.
         */
        var beforeRequest: CacheDetails?,
        /**
         * State of a cache entry after the request.
         *
         * Leave out this field if the information is not available.
         */
        var afterRequest: CacheDetails?,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    data class CacheDetails(
        /**
         * Expiration time of the cache entry.
         *
         * _(Format not documente but assumingly ISO 8601 -
         * `YYYY-MM-DDThh:mm:ss.sTZD`)_
         */
        var expires: String?,
        /**
         * The last time the cache entry was opened.
         *
         * _(Format not documente but assumingly ISO 8601 -
         * `YYYY-MM-DDThh:mm:ss.sTZD`)_
         */
        var lastAccess: String,
        /** Etag */
        var eTag: String,
        /** The number of times the cache entry has been opened. */
        var hitCount: Number,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * This object describes various phases within request-response round trip.
     *
     * All times are specified in milliseconds.
     *
     * http://www.softwareishard.com/blog/har-12-spec/#timings
     */
    data class Timings(
        /**
         * Time spent in a queue waiting for a network connection.
         *
         * Use `-1` if the timing does not apply to the current request.
         */
        var blocked: Number?,
        /**
         * DNS resolution time. The time required to resolve a host name.
         *
         * Use `-1` if the timing does not apply to the current request.
         */
        var dns: Number?,
        /**
         * Time required to create TCP connection.
         *
         * Use `-1` if the timing does not apply to the current request.
         */
        var connect: Number?,
        /**
         * Time required to send HTTP request to the server.
         *
         * _Not optional and must have non-negative values._
         */
        var send: Number?,
        /**
         * Waiting for a response from the server.
         *
         * _Not optional and must have non-negative values._
         */
        var wait: Number,
        /**
         * Time required to read entire response from the server (or cache).
         *
         * _Not optional and must have non-negative values._
         */
        var receive: Number,
        /**
         * Time required for SSL/TLS negotiation.
         *
         * If this field is defined then the time is also included in the connect
         * field (to ensure backward compatibility with HAR 1.1).
         *
         * Use `-1` if the timing does not apply to the current request.
         */
        var ssl: Number?,
        /**  A comment provided by the user or the application */
        var comment: String?,
    )

    /**
     * 表示POST数据的密封类，可以是参数形式或文本形式
     */
    sealed class PostData {
        abstract val common: PostDataCommon

        /** 参数形式的POST数据 */
        data class Params(
            override val common: PostDataCommon,
            val params: List<Param>
        ) : PostData()

        /** 文本形式的POST数据 */
        data class Text(
            override val common: PostDataCommon,
            val text: String
        ) : PostData()
    }
}